#ifndef AMAZO_DYNLIST
#define AMAZO_DYNLIST

/* Structures */
typedef struct dynlist_node {
	void *data;
	
	struct dynlist_node *next;
	struct dynlist_node *prev;
} dynlist_node_t;
typedef struct dynlist {
	char *name;
	int count;

	struct dynlist_node *root;	
	
	void (*free_data)(void *);
} dynlist_t;

/* Functions */
dynlist_t * dynlist_create(char *name, void (*free_func)(void *));
void dynlist_free(dynlist_t **list);

// Stack like functions
void dynlist_push(dynlist_t *list, void *data);
void * dynlist_pop(dynlist_t *list);

// Return a specific data pointer
void * dynlist_get(dynlist_t * list, int i);
void dynlist_remove(dynlist_t * list, int i);

#endif
